//
//  ManageCell.m
//  SG
//
//  Created by FISH on 2018/4/26.
//  Copyright © 2018年 yimindai. All rights reserved.
//

#import "ManageCell.h"

@implementation ManageCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

+ (instancetype)cellWithTableView:(UITableView*)tableView
{
    static NSString *identifier = @"ManageCell";
    ManageCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if(cell == nil)
    {
        cell = [[[NSBundle mainBundle]loadNibNamed:identifier owner:nil options:nil] firstObject];
    }
    cell.mainSeparatorView.frame = CGRectMake(0, 0, kScreenWidth, 8);
    cell.mainSeparatorView.backgroundColor = RGB(238, 239, 241);
#pragma 外部
    cell.topView.frame = CGRectMake(0, cell.mainSeparatorView.frame.size.height, kScreenWidth, kRealValue(54));
    cell.topSeparatorView.frame = CGRectMake(0, cell.topView.frame.origin.y+cell.topView.frame.size.height, kScreenWidth, 2);
    cell.btmView.frame = CGRectMake(0, cell.contentView.frame.size.height-kRealValue(54), kScreenWidth, kRealValue(54));
    cell.btmSeparatorView.frame = CGRectMake(0, cell.contentView.frame.size.height-kRealValue(54)-2, kScreenWidth, 2);
    cell.mainView.frame = CGRectMake(0, cell.topSeparatorView.frame.origin.y+cell.topSeparatorView.frame.size.height, kScreenWidth, cell.contentView.frame.size.height-kRealValue(54)-2-cell.topSeparatorView.frame.origin.y-cell.topSeparatorView.frame.size.height);


#pragma topView内部
    cell.topViewLeftView.frame = CGRectMake(0, (cell.topView.frame.size.height-24)/2, 5, 24);
    cell.topViewLeftLabel.frame = CGRectMake(20, 0, (kScreenWidth-40)/2, cell.topView.frame.size.height);
    cell.topViewRightLabel.frame = CGRectMake(20+(kScreenWidth-40)/2, 0, (kScreenWidth-40)/2, cell.topView.frame.size.height);

#pragma btmView内部
    cell.btmViewLeftLabel.frame = CGRectMake(20, 0, (kScreenWidth-40)/2, cell.btmView.frame.size.height);
    cell.btmViewRightLabel.frame = CGRectMake(20+(kScreenWidth-40)/2, 0, (kScreenWidth-40)/2, cell.btmView.frame.size.height);
    
#pragma mainView内部
    cell.mainViewLeftLabel.frame = CGRectMake(0, 0, cell.mainView.frame.size.width*0.3, cell.mainView.frame.size.height);
    cell.mainViewLeftLabel.numberOfLines = 0;
    cell.mainViewLeftLabel.attributedText = [self setMutableAttributedString:@"5位\n服务者应邀" didInitialColor:[UIColor blackColor] atIndexCurrentColor:RGB(231, 0, 17) didMakeRange:NSMakeRange(0, 1)];

    cell.mainViewRightScrollView.frame = CGRectMake(cell.mainView.frame.size.width*0.3, 0, kScreenWidth-cell.mainView.frame.size.width*0.3, cell.mainView.frame.size.height);
    cell.mainViewRightScrollView.contentSize = CGSizeMake(cell.mainViewRightScrollView.frame.size.width, cell.mainView.frame.size.height);
    cell.mainViewRightScrollView.scrollEnabled = NO;
    
    NSArray *imageArray = @[@"liuyan1",@"liuyan2",@"liuyan3",@"liuyan4",@"liuyan5",@"liuyan6",@"photo_sample_01",@"photo_sample_02",@"photo_sample_03",@"photo_sample_04"];
    int imageViewWidth = cell.mainViewRightScrollView.frame.size.width/11*1.8;
    for(int i=0;i<imageArray.count;i++)
    {
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake((imageViewWidth/2)*i, (cell.mainView.frame.size.height-imageViewWidth)/2, imageViewWidth, imageViewWidth)];
        imageView.image = [UIImage imageNamed:StringFormat(@"%@",imageArray[i])];
        imageView.layer.masksToBounds = YES;
        imageView.layer.cornerRadius = imageView.frame.size.height/2;
        [cell.mainViewRightScrollView addSubview:imageView];
    }
    
    return cell;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
